package generator.statements;

/**
 * ReservationTraveller SQL record mapper.
 * 
 * @author Necro
 * @author Marek Snopkowski <snpy@snpy.info>
 * @version 12.04.2008
 */
public class ReservationTraveller extends Statement
{
    private Reservation reservation;
    private Traveller traveller;

    public ReservationTraveller(Reservation reservation, Traveller traveller) 
    {
        this.reservation = reservation;
        this.traveller   = traveller;
    }
    
    @Override
    public int getId() throws UnsupportedOperationException
    {
        return traveller.getId() + (reservation.getId() << 8);
    }
    
    //@todo funkcjonalność Reservation_Traveller
    
    public Object[] getFieldsValueCollection()
    {
        return new Object[]{ reservation.getId(), traveller.getId() };
    }
    
    public String getFieldsNameSet()
    {
        return "[reservation_id], [traveller_id]";
    }

    @Override
    public String getTableName()
    {
        return "reservation_traveller";
    }
}
